﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Fast.Presentation.Bematech;
using Fast.Presentation.WinForms.Factory;
using Fast.Presentation.Print;
using Contract.Business.Entity;
using Contract.Business.Process;
using Contract.Business.Filter;

namespace Fast.Presentation.WinForms
{
    public partial class PrintTest : Form
    {
        public PrintTest()
        {
            InitializeComponent();
        }

        private void btnImprimir_Click(object sender, EventArgs e)
        {
            try
            {
                BEConfiguracao config;
                BPConfiguracao processConfig = new BPConfiguracao();
                config = processConfig.ObterTodos(new FEConfiguracao()).First();

                IPrinter impressora = PrinterFactory.getPrinter(config.CodigoImpressora.Value);
                impressora.imprimir(this.txtPrint.Text);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        private void PrintTest_Load(object sender, EventArgs e)
        {
            this.btnImprimir.PerformClick();
        }
    }
}
